home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / aepopup3 / data1.cab / Popup_Properties_6 / EntryBox.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-05-05  |  20.4 KB  |  569 lines

  1. VERSION 5.00
  2. Object = "{4E36AC7F-0302-11D3-AFE0-B4CDD86B7B11}#1.0#0"; "AePopup6D.OCX"
  3. Begin VB.Form frmEntryBox 
  4.    ClientHeight    =   4200
  5.    ClientLeft      =   60
  6.    ClientTop       =   60
  7.    ClientWidth     =   7620
  8.    ControlBox      =   0   'False
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   4200
  13.    ScaleWidth      =   7620
  14.    WindowState     =   2  'Maximized
  15.    Begin VB.PictureBox picFrame 
  16.       Appearance      =   0  'Flat
  17.       ClipControls    =   0   'False
  18.       ForeColor       =   &H80000008&
  19.       Height          =   3495
  20.       Left            =   120
  21.       ScaleHeight     =   231
  22.       ScaleMode       =   3  'Pixel
  23.       ScaleWidth      =   475
  24.       TabIndex        =   1
  25.       TabStop         =   0   'False
  26.       Top             =   240
  27.       Width           =   7155
  28.       Begin AePopup6D.AeCommandBox acbClearEvents 
  29.          Height          =   210
  30.          Left            =   1950
  31.          TabIndex        =   20
  32.          TabStop         =   0   'False
  33.          ToolTipText     =   "Clear events"
  34.          Top             =   1395
  35.          Width           =   555
  36.          _ExtentX        =   979
  37.          _ExtentY        =   370
  38.          BackColor       =   -2147483632
  39.          ForeColor       =   -2147483628
  40.          Picture         =   "EntryBox.frx":0000
  41.          Appearance      =   2
  42.          ShowFocus       =   0   'False
  43.       End
  44.       Begin VB.Timer tmrStopwatch 
  45.          Enabled         =   0   'False
  46.          Interval        =   1000
  47.          Left            =   240
  48.          Top             =   720
  49.       End
  50.       Begin VB.TextBox txtEvents 
  51.          Appearance      =   0  'Flat
  52.          BackColor       =   &H8000000F&
  53.          BorderStyle     =   0  'None
  54.          Height          =   1695
  55.          Left            =   90
  56.          Locked          =   -1  'True
  57.          MultiLine       =   -1  'True
  58.          ScrollBars      =   2  'Vertical
  59.          TabIndex        =   17
  60.          TabStop         =   0   'False
  61.          Text            =   "EntryBox.frx":00BE
  62.          Top             =   1620
  63.          Width           =   2415
  64.       End
  65.       Begin VB.Frame frmProperties 
  66.          Caption         =   "Properties"
  67.          Height          =   3250
  68.          Left            =   2640
  69.          TabIndex        =   2
  70.          Top             =   60
  71.          Width           =   4400
  72.          Begin AePopup6D.AeEntryBox aebMinValue 
  73.             Height          =   315
  74.             Left            =   1440
  75.             TabIndex        =   8
  76.             Top             =   1140
  77.             Width           =   1275
  78.             _ExtentX        =   2249
  79.             _ExtentY        =   556
  80.          End
  81.          Begin AePopup6D.AeEntryBox aebMaxValue 
  82.             Height          =   315
  83.             Left            =   2940
  84.             TabIndex        =   9
  85.             Top             =   1140
  86.             Width           =   1275
  87.             _ExtentX        =   2249
  88.             _ExtentY        =   556
  89.          End
  90.          Begin VB.Frame frmPopupForm 
  91.             Caption         =   "Popup Form"
  92.             Height          =   1215
  93.             HelpContextID   =   4
  94.             Index           =   1
  95.             Left            =   2520
  96.             TabIndex        =   14
  97.             Top             =   1800
  98.             Width           =   1695
  99.             Begin VB.CheckBox chkRightAlign 
  100.                Caption         =   "&RightAlign"
  101.                Height          =   255
  102.                HelpContextID   =   811
  103.                Left            =   120
  104.                TabIndex        =   15
  105.                Top             =   360
  106.                Width           =   1215
  107.             End
  108.             Begin VB.CheckBox chkMoveWithParent 
  109.                Caption         =   "&MoveWithParent"
  110.                Height          =   255
  111.                HelpContextID   =   814
  112.                Left            =   120
  113.                TabIndex        =   16
  114.                Top             =   720
  115.                Width           =   1515
  116.             End
  117.          End
  118.          Begin VB.CheckBox chkPicture 
  119.             Caption         =   "&Picture"
  120.             Height          =   255
  121.             Left            =   240
  122.             TabIndex        =   13
  123.             Top             =   2820
  124.             Width           =   915
  125.          End
  126.          Begin VB.CheckBox chkCustomised 
  127.             Caption         =   "C&ustomised"
  128.             Height          =   255
  129.             Left            =   240
  130.             TabIndex        =   12
  131.             Top             =   2460
  132.             Width           =   1455
  133.          End
  134.          Begin VB.ComboBox cboDataType 
  135.             Height          =   315
  136.             HelpContextID   =   109
  137.             ItemData        =   "EntryBox.frx":00C7
  138.             Left            =   1740
  139.             List            =   "EntryBox.frx":00F5
  140.             Style           =   2  'Dropdown List
  141.             TabIndex        =   4
  142.             Top             =   300
  143.             Width           =   2475
  144.          End
  145.          Begin VB.CheckBox chkAutoComplete 
  146.             Caption         =   "Auto &Complete"
  147.             Height          =   255
  148.             HelpContextID   =   114
  149.             Left            =   240
  150.             TabIndex        =   11
  151.             Top             =   2100
  152.             Width           =   1635
  153.          End
  154.          Begin VB.ComboBox cboFormatString 
  155.             Height          =   315
  156.             HelpContextID   =   110
  157.             ItemData        =   "EntryBox.frx":016F
  158.             Left            =   1740
  159.             List            =   "EntryBox.frx":0171
  160.             TabIndex        =   6
  161.             Top             =   720
  162.             Width           =   2475
  163.          End
  164.          Begin VB.CheckBox chkUpperCase 
  165.             Caption         =   "Force &Upper Case"
  166.             Height          =   255
  167.             HelpContextID   =   111
  168.             Left            =   240
  169.             TabIndex        =   10
  170.             Top             =   1740
  171.             Width           =   1635
  172.          End
  173.          Begin VB.Label lblProperties 
  174.             AutoSize        =   -1  'True
  175.             Caption         =   "Min/Max&Value:"
  176.             Height          =   195
  177.             Index           =   1
  178.             Left            =   240
  179.             TabIndex        =   7
  180.             Top             =   1200
  181.             Width           =   1080
  182.          End
  183.          Begin VB.Label Label1 
  184.             AutoSize        =   -1  'True
  185.             Caption         =   "/"
  186.             Height          =   195
  187.             Left            =   2760
  188.             TabIndex        =   19
  189.             Top             =   1200
  190.             Width           =   75
  191.          End
  192.          Begin VB.Label lblProperties 
  193.             AutoSize        =   -1  'True
  194.             Caption         =   "&Data Type:"
  195.             Height          =   195
  196.             Index           =   0
  197.             Left            =   240
  198.             TabIndex        =   3
  199.             Top             =   360
  200.             Width           =   795
  201.          End
  202.          Begin VB.Label lblProperties 
  203.             AutoSize        =   -1  'True
  204.             Caption         =   "&Format String:"
  205.             Height          =   195
  206.             Index           =   6
  207.             Left            =   240
  208.             TabIndex        =   5
  209.             Top             =   780
  210.             Width           =   975
  211.          End
  212.          Begin VB.Image imgClosedFolder 
  213.             Height          =   195
  214.             Left            =   1260
  215.             Picture         =   "EntryBox.frx":0173
  216.             Top             =   2820
  217.             Visible         =   0   'False
  218.             Width           =   240
  219.          End
  220.          Begin VB.Image imgOpenFolder 
  221.             Height          =   195
  222.             Left            =   1620
  223.             Picture         =   "EntryBox.frx":025D
  224.             Top             =   2820
  225.             Visible         =   0   'False
  226.             Width           =   240
  227.          End
  228.       End
  229.       Begin AePopup6D.AeEntryBox aebMain 
  230.          Height          =   315
  231.          HelpContextID   =   101
  232.          Left            =   240
  233.          TabIndex        =   0
  234.          Top             =   300
  235.          Width           =   2295
  236.          _ExtentX        =   4048
  237.          _ExtentY        =   556
  238.          MousePointer    =   0
  239.          Style           =   4
  240.          DataType        =   7
  241.          FormatString    =   "Short Date"
  242.       End
  243.       Begin VB.Label lblEvents 
  244.          BackColor       =   &H80000010&
  245.          Caption         =   "Events:"
  246.          ForeColor       =   &H80000014&
  247.          Height          =   210
  248.          Left            =   90
  249.          TabIndex        =   18
  250.          Top             =   1400
  251.          Width           =   2415
  252.       End
  253.    End
  254. Attribute VB_Name = "frmEntryBox"
  255. Attribute VB_GlobalNameSpace = False
  256. Attribute VB_Creatable = False
  257. Attribute VB_PredeclaredId = True
  258. Attribute VB_Exposed = False
  259. Option Explicit
  260. Private WithEvents m_PopupForm As AePopupForm
  261. Attribute m_PopupForm.VB_VarHelpID = -1
  262. Private Const M_S_EntryBoxWidth = 0
  263. Private Const M_S_PropsLeft = 1
  264. Private Const M_S_PropsHeight = 2
  265. Private Const M_S_EventsHeight = 3
  266. Private Const M_S_EventsWidth = 4
  267. Private Const M_S_ClearEventsLeft = 5
  268. Private m_Offsets(M_S_EntryBoxWidth To M_S_ClearEventsLeft) As Integer
  269. Public Property Let Style(ByVal New_Style As AeEntryBoxStyles)
  270.      tmrStopwatch.Enabled = False
  271.      
  272.     aebMain.List.Clear
  273.      If New_Style = aeComboBox Then
  274.          With aebMain.List
  275.              .Add "Apples"
  276.              .Add "Bananas"
  277.              .Add "Oranges"
  278.              .Add "Lemons"
  279.              .Add "Plums"
  280.              .Add "Cherries"
  281.          End With
  282.          aebMain.Text = "Apples"
  283.      ElseIf New_Style = aeSpinBox Then
  284.          aebMain.Text = 0
  285.      End If
  286.      
  287.      'set up the custom box
  288.      If New_Style = aeCustomBox Then
  289.          aebMain.Style = aeTimeBox
  290.          aebMain.FormatString = "hh:nn:ss"
  291.          Dim oButton As AeButton
  292.          'menu button
  293.          Set oButton = aebMain.Buttons.Add()
  294.          aebMain.Buttons.Actions(2) = aePopupMenu
  295.          aebMain.Buttons.Symbols(2) = aeComboSymbol
  296.          aebMain.Menu.Add "5 seconds"
  297.          aebMain.Menu.Add "10 seconds"
  298.          aebMain.Menu.Add "30 seconds"
  299.          aebMain.Menu.Add "1 minute"
  300.          aebMain.Menu.Add "5 minutes"
  301.          'play button
  302.          Set oButton = aebMain.Buttons.Add()
  303.          oButton.Style = aeGroupButton
  304.          oButton.ToolTipText = "Start"
  305.          aebMain.Buttons.Symbols(3) = aePlaySymbol
  306.          'stop button
  307.          Set oButton = aebMain.Buttons.Add()
  308.          oButton.Style = aeGroupButton
  309.          oButton.ToolTipText = "Stop"
  310.          aebMain.Buttons.Symbols(4) = aeStopSymbol
  311.          'pause button
  312.          Set oButton = aebMain.Buttons.Add()
  313.          oButton.Style = aeToggleButton
  314.          oButton.ToolTipText = "Pause"
  315.          aebMain.Buttons.Symbols(5) = aePauseSymbol
  316.          
  317.          aebMain.Buttons(4).Value = aeToggled
  318.      Else
  319.          aebMain.Menu.Clear
  320.          aebMain.Style = New_Style
  321.      End If
  322.      
  323.      'some properties are reset with the style
  324.      Dim n As Integer
  325.      Dim iType As Integer
  326.      iType = aebMain.DataType
  327.      For n = 0 To cboDataType.ListCount - 1
  328.          If cboDataType.ItemData(n) = iType Then Exit For
  329.      Next n
  330.      If n < cboDataType.ListCount Then cboDataType.ListIndex = n
  331.      cboFormatString.Text = aebMain.FormatString
  332. End Property
  333. Private Sub acbClearEvents_Click()
  334.     txtEvents.Text = "(none)"
  335. End Sub
  336. Private Sub aebMain_ActionSet(ByVal ActionCode As AePopup6D.AeEntryBoxActions, Cancel As Boolean)
  337.     Dim s As String
  338.     Select Case ActionCode
  339.         Case aeDecreaseValue:  s = "aeDecreaseValue"
  340.         Case aeIncreaseValue:  s = "aeIncreaseValue"
  341.         Case aePopupCalendar:  s = "aePopupCalendar"
  342.         Case aePopupClock:  s = "aePopupClock"
  343.         Case aePopupCustom:  s = "aePopupCustom"
  344.         Case aePopupList:  s = "aePopupList"
  345.         Case aePopupMenu:  s = "aePopupMenu"
  346.         Case aeSetFalse:  s = "aeSetFalse"
  347.         Case aeSetTrue:  s = "aeSetTrue"
  348.     End Select
  349.     p_AddEvent "ActionSet" & vbTab & s
  350.         
  351. End Sub
  352. Private Sub aebMain_ButtonClick(Button As AePopup6D.AeButton)
  353.     p_AddEvent "ButtonClick" & vbTab & CStr(Button.Index)
  354.     'stopwatch functions for aeCustomBox
  355.     If aebMain.Style = aeCustomBox Then
  356.         Select Case Button.Index
  357.             Case 3 'play
  358.                 tmrStopwatch.Enabled = True
  359.             Case 4 'stop
  360.                 tmrStopwatch.Enabled = False
  361.                 aebMain.Text = ""
  362.                 aebMain.Buttons(5).Value = aeUp 'un-pause
  363.             Case 5 'pause
  364.                 tmrStopwatch.Enabled = (Button.Value = aeUp)
  365.         End Select
  366.     End If
  367. End Sub
  368. Private Sub aebMain_Change()
  369.     p_AddEvent "Change"
  370. End Sub
  371. Private Sub aebMain_Click()
  372.     p_AddEvent "Click"
  373. End Sub
  374. Private Sub aebMain_MenuClick(MenuItem As AePopup6D.AeMenuItem)
  375.     p_AddEvent "MenuClick" & vbTab & CStr(MenuItem.Index)
  376.     Select Case MenuItem.Index
  377.         Case 1: aebMain.Value = TimeSerial(0, 0, 5)
  378.         Case 2: aebMain.Value = TimeSerial(0, 0, 10)
  379.         Case 3: aebMain.Value = TimeSerial(0, 0, 30)
  380.         Case 4: aebMain.Value = TimeSerial(0, 1, 0)
  381.         Case 5: aebMain.Value = TimeSerial(0, 5, 0)
  382.     End Select
  383. End Sub
  384. Private Sub aebMain_MenuHighlight(MenuItem As AePopup6D.AeMenuItem)
  385.     p_AddEvent "MenuHighlight" & vbTab & CStr(MenuItem.Index)
  386. End Sub
  387. Private Sub aebMain_MenuPopup(Menu As AePopup6D.AeMenu)
  388.     p_AddEvent "MenuPopup"
  389. End Sub
  390. Private Sub aebMaxValue_Change()
  391.     aebMain.MaxValue = aebMaxValue.Value
  392. End Sub
  393. Private Sub aebMinValue_Change()
  394.     aebMain.MinValue = aebMinValue.Value
  395. End Sub
  396. Private Sub cboDataType_Click()
  397.     Dim bEnabled As Boolean
  398.     aebMain.DataType = cboDataType.ItemData(cboDataType.ListIndex)
  399.     cboFormatString.Clear
  400.     bEnabled = True
  401.     Select Case aebMain.DataType
  402.         Case aeBoolean
  403.             cboFormatString.AddItem "True/False"
  404.             cboFormatString.AddItem "Yes/No"
  405.             bEnabled = False
  406.         Case aeDate
  407.             cboFormatString.AddItem "General Date"
  408.             cboFormatString.AddItem "Short Date"
  409.             cboFormatString.AddItem "dd, mmmm yyyy"
  410.             cboFormatString.AddItem "dd-mmm-yyyy"
  411.             cboFormatString.AddItem "mmm yyyy"
  412.             aebMinValue.Style = aeDateBox
  413.             aebMaxValue.Style = aeDateBox
  414.         Case aeTime
  415.             cboFormatString.AddItem "Long Time"
  416.             cboFormatString.AddItem "Short Time"
  417.             cboFormatString.AddItem "hh:nn am/pm"
  418.             aebMinValue.Style = aeTimeBox
  419.             aebMaxValue.Style = aeTimeBox
  420.         Case aeCurrency
  421.             aebMinValue.Style = aeSpinBox
  422.             aebMaxValue.Style = aeSpinBox
  423.             aebMinValue.DataType = aebMain.DataType
  424.             aebMaxValue.DataType = aebMain.DataType
  425.             cboFormatString.AddItem "Currency"
  426.         Case aeLong, aeInteger, aeSingle, aeDouble, aeDecimal
  427.             aebMinValue.Style = aeSpinBox
  428.             aebMaxValue.Style = aeSpinBox
  429.             aebMinValue.DataType = aebMain.DataType
  430.             aebMaxValue.DataType = aebMain.DataType
  431.         Case aeVariant
  432.             aebMinValue.Style = aeTextBox
  433.             aebMaxValue.Style = aeTextBox
  434.             aebMinValue.DataType = aeString
  435.             aebMaxValue.DataType = aeString
  436.         Case Else
  437.             aebMinValue.Style = aeTextBox
  438.             aebMaxValue.Style = aeTextBox
  439.             aebMinValue.DataType = aeString
  440.             aebMaxValue.DataType = aeString
  441.             aebMinValue.Value = Empty
  442.             aebMaxValue.Value = Empty
  443.             bEnabled = False
  444.     End Select
  445.     aebMinValue.Enabled = bEnabled
  446.     aebMaxValue.Enabled = bEnabled
  447.     If bEnabled Then
  448.         
  449.     Else
  450.     End If
  451. End Sub
  452. Private Sub cboFormatString_Change()
  453.     On Error Resume Next 'incase invalid format string
  454.     aebMain.FormatString = cboFormatString.Text
  455. End Sub
  456. Private Sub cboFormatString_Click()
  457.     aebMain.FormatString = cboFormatString.Text
  458. End Sub
  459. Private Sub chkAutoComplete_Click()
  460.     aebMain.AutoComplete = (chkAutoComplete = vbChecked)
  461. End Sub
  462. Private Sub chkCustomised_Click()
  463.     If chkCustomised.Value = vbChecked Then
  464.         aebMain.BackColor = RGB(255, 255, 200)
  465.         aebMain.ForeColor = vbBlue
  466.         Dim oFont As New StdFont
  467.         oFont.Name = "MS Serif"
  468.         oFont.Size = 10
  469.         Set aebMain.Font = oFont
  470.         aebMain.Height = 24
  471.     Else 'defaults
  472.         aebMain.BackColor = vbWindowBackground
  473.         aebMain.ForeColor = vbWindowText
  474.         Set aebMain.Font = picFrame.Font
  475.         aebMain.Height = 21
  476.     End If
  477. End Sub
  478. Private Sub chkMoveWithParent_Click()
  479.     aebMain.PopupForm.MoveWithParent = (chkMoveWithParent.Value = vbChecked)
  480. End Sub
  481. Private Sub chkPicture_Click()
  482.     If chkPicture.Value = vbChecked Then
  483.         Set aebMain.Picture = imgClosedFolder.Picture
  484.         aebMain.PictureWidth = 20
  485.     Else 'defaults
  486.         aebMain.PictureWidth = 0
  487.         Set aebMain.Picture = Nothing
  488.     End If
  489. End Sub
  490. Private Sub chkRightAlign_Click()
  491.     aebMain.PopupForm.RightAlign = (chkRightAlign.Value = vbChecked)
  492. End Sub
  493. Private Sub chkUpperCase_Click()
  494.     aebMain.UpperCase = (chkUpperCase.Value = vbChecked)
  495. End Sub
  496. Private Sub Form_Load()
  497.     'initialise property controls
  498.     cboDataType.ListIndex = 3 'aeDate
  499.     cboFormatString.Text = aebMain.FormatString
  500.     chkAutoComplete.Value = Abs(aebMain.AutoComplete)
  501.     chkUpperCase.Value = Abs(aebMain.UpperCase)
  502.     chkRightAlign.Value = Abs(aebMain.PopupForm.RightAlign)
  503.     chkMoveWithParent.Value = Abs(aebMain.PopupForm.MoveWithParent)
  504.     'hook in to popup form events
  505.     Set m_PopupForm = aebMain.PopupForm
  506.     'set up resizing frame
  507.     With picFrame
  508.         m_Offsets(M_S_EntryBoxWidth) = .ScaleWidth - aebMain.Width
  509.         m_Offsets(M_S_PropsLeft) = .ScaleWidth - frmProperties.Left
  510.         m_Offsets(M_S_PropsHeight) = .ScaleHeight - frmProperties.Height
  511.         m_Offsets(M_S_EventsHeight) = .ScaleHeight - txtEvents.Height
  512.         m_Offsets(M_S_EventsWidth) = .ScaleWidth - txtEvents.Width
  513.         m_Offsets(M_S_ClearEventsLeft) = .ScaleWidth - acbClearEvents.Left
  514.         .BorderStyle = 0
  515.     End With
  516. End Sub
  517. Private Sub Form_Resize()
  518.     picFrame.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  519. End Sub
  520. Private Sub Form_Unload(Cancel As Integer)
  521.     'clean up references
  522.     Set m_PopupForm = Nothing
  523. End Sub
  524. Private Sub m_PopupForm_Load(ByVal Modal As Boolean)
  525.     'change the picture whenever a popup form is shown
  526.     If chkPicture.Value = vbChecked Then
  527.         Set aebMain.Picture = imgOpenFolder.Picture
  528.     End If
  529. End Sub
  530. Private Sub m_PopupForm_Unload(Cancel As Boolean, ByVal UnloadMode As Integer)
  531.     'change the picture whenever the popup form is hidden
  532.     If chkPicture.Value = vbChecked Then
  533.         Set aebMain.Picture = imgClosedFolder.Picture
  534.     End If
  535. End Sub
  536. Private Sub picFrame_Resize()
  537.     'reposition controls
  538.     aebMain.Width = Abs(picFrame.ScaleWidth - m_Offsets(M_S_EntryBoxWidth))
  539.     frmProperties.Left = Abs(picFrame.ScaleWidth - m_Offsets(M_S_PropsLeft))
  540.     frmProperties.Height = Abs(picFrame.ScaleHeight - m_Offsets(M_S_PropsHeight))
  541.     txtEvents.Height = Abs(picFrame.ScaleHeight - m_Offsets(M_S_EventsHeight))
  542.     txtEvents.Width = Abs(picFrame.ScaleWidth - m_Offsets(M_S_EventsWidth))
  543.     lblEvents.Width = Abs(picFrame.ScaleWidth - m_Offsets(M_S_EventsWidth))
  544.     acbClearEvents.Left = Abs(picFrame.ScaleWidth - m_Offsets(M_S_ClearEventsLeft))
  545. End Sub
  546. Private Sub tmrStopwatch_Timer()
  547.     Dim d As Date
  548.     d = aebMain.Value - TimeSerial(0, 0, 1)
  549.     If d <= 0 Then
  550.         aebMain.Value = 0
  551.         aebMain.Buttons(4).Value = aeToggled
  552.     Else
  553.         aebMain.Value = d
  554.     End If
  555. End Sub
  556. 'Private Methods
  557. '==============
  558. Private Sub p_AddEvent(Caption As String)
  559.     Dim sText As String
  560.     sText = txtEvents.Text
  561.     If Left$(sText, 6) = "(none)" Then
  562.         sText = Caption
  563.     Else
  564.         sText = sText & vbCrLf & Caption
  565.     End If
  566.     txtEvents.Text = sText
  567.     txtEvents.SelStart = Len(sText)
  568. End Sub
  569.